package com.test1230pm;

public class Test01 {
    public static void main(String[] args) {
        // (1)设计一个长方形类
        // 属性：长、宽
        // 功能：周长、面积
        // 要求：分别创建3个不同的对象、求周长、求面积
        Rectangle r = new Rectangle(3,4);
        r.zhouC();
        r.mianJ();
        Rectangle r1 = new Rectangle(5,6);
        r1.zhouC();
        r1.mianJ();
        Rectangle r2 = new Rectangle(7,8);
        r2.zhouC();
        r2.mianJ();
    }


}
class Rectangle{
    private int len;
    private int wide;

    public Rectangle() {
    }

    public Rectangle(int len, int wide) {
        this.len = len;
        this.wide = wide;
    }
    public void zhouC(){
        System.out.println("周长"+(len+wide)*2);
    }
    public void mianJ(){
        System.out.println("面积为"+len*wide);
    }

    public int getLen() {
        return len;
    }

    public void setLen(int len) {
        this.len = len;
    }

    public int getWide() {
        return wide;
    }

    public void setWide(int wide) {
        this.wide = wide;
    }

    @Override
    public String toString() {
        return "Rectangle{" +
                "len=" + len +
                ", wide=" + wide +
                '}';
    }
}